package com.kgc.service.impl;

import com.kgc.dao.TicketInfoMapper;
import com.kgc.dao.TicketInfoMapperEx;
import com.kgc.pojo.TicketInfo;
import com.kgc.pojo.TicketInfoExample;
import com.kgc.service.TicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TicketServiceImpl implements TicketService {

    @Autowired
    private TicketInfoMapper ticketInfoMapper;

    @Autowired
    private TicketInfoMapperEx ticketInfoMapperEx;

    //根据票名查询单张票的信息
    @Override
    @Cacheable(value = "TicketInfo",key = "'getTicketInfo'.concat(#id)")
    public TicketInfo getTicketInfo(Integer id) {
        return  ticketInfoMapperEx.getTicketInfo(id);
    }
    @Override
    public List<TicketInfo> getRendering() {
        TicketInfoExample ticketInfoExample=new TicketInfoExample();
        ticketInfoExample.createCriteria();
        List<TicketInfo> ticketInfos = ticketInfoMapper.selectByExample(ticketInfoExample);
        return ticketInfos;
    }
}
